package com.github.pig.nideshop.controller.user;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.common.util.ZyResult;
import com.github.pig.nideshop.entity.NideshopProduct;
import com.github.pig.nideshop.entity.NideshopProductDetail;
import com.github.pig.nideshop.entity.NideshopProductType;
import com.github.pig.nideshop.service.INideshopProductDetailService;
import com.github.pig.nideshop.service.INideshopProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author J神
 * @since 2018-06-23
 */
@RestController
@RequestMapping("/productTypes")
public class NideshopProductTypeController {
    @Autowired
    private INideshopProductTypeService nideshopProductTypeService;
    @Autowired
    private INideshopProductDetailService nideshopProductDetailService;
    @GetMapping
    public ZyResult productTypes(NideshopProductType nideshopProductType, Page page){
        return ZyResult.ok(nideshopProductTypeService.selectPage(page,new EntityWrapper<>(nideshopProductType)));
    }
    @GetMapping("/details/{typeId}")
    public ZyResult productDetails(NideshopProductDetail nideshopProductDetail, Page page){
        return ZyResult.ok(nideshopProductDetailService.selectPage(page,new EntityWrapper<>(nideshopProductDetail)));
    }
}

